home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / dev / lang / uc_0_30.lha / u / rdocs / r0005.doc < prev    next >
Text File  |  1996-10-30  |  10KB  |  505 lines

  1. **********************
  2. * P R O J E C T  < U >
  3. *
  4. * Author and copyright
  5. * (c) 1996
  6. * Paul van der Valk
  7. *
  8. * file: r0005.doc
  9. * last updated: 30-oct-96
  10.  
  11.  
  12.                         THE UCODE FORMAT
  13.  
  14.  
  15.  
  16. An UCode database (UCDB) is a subclass of a U Database (UDB). 
  17. This document describes the contents of the record-datablock. For a 
  18. complete image of the file structure please refer to r0004.doc. 
  19.  
  20. The UDB-app fields are assigned assigned:
  21.  
  22.      AppID:  the hexadecimal constant DB1DEA01
  23.      AppUsr  the ucode version, currently 2.
  24.  
  25.  
  26. Each ucode-record has the following format:
  27.  
  28.    NX RT P1 P2 P3 [A1 [A2 .. [AN]]] [STR]
  29.  
  30.  
  31. Where:
  32.  
  33.    NX is a unsigned 32 bits integer that points to the optional
  34.       next record in a chain.
  35.  
  36.    RT is a unsigned 8 bits integer that defines the record type.
  37.  
  38.    P1 is an 8 bits property. The meaning of this property depends
  39.       on the record type (RT). Undefined instances must have a value
  40.       of 0 for future compatibility.
  41.  
  42.    P2 is an 8 bits property. See also P1.
  43.  
  44.    P3 is an 8 bits property. See also P2.
  45.  
  46.    A1..AN are 32 bits arguments. The amount and type of arguments
  47.           depends on the record type (RT).
  48.  
  49.    STR is a null terminated sequence of characters, padded with zeros
  50.        to a 4-byte boundary. Whether a string is present depends on the
  51.        record type (RT).
  52.  
  53.  
  54. LISTING OF UCODE RECORDS
  55.  
  56.  
  57. * --- RECORD TYPE 0 - Undefined
  58.  
  59.   NR  RT P1 P2 P3 
  60. +----+--+--+--+--+
  61. |next|00|--|--|--|
  62. +----+--+--+--+--+
  63.  
  64. * Record type 0 is by definition undefined. Backends should report an
  65.   error when such record is encountered.
  66.  
  67.      defined: 0.1
  68.  
  69.  implemented
  70.      l uca2b: 0.1
  71.      umgk -l: 0.1
  72.      umgk -x: 0.1
  73.  
  74.  
  75.  
  76. * --- RECORD TYPE 1 - Header
  77.  
  78.   NR  RT P1 P2 P3  A1   A2   A3   A4
  79. +----+--+--+--+--+----+----+----+----+
  80. |next|01|--|--|--|root| -- | -- | -- |
  81. +----+--+--+--+--+----+----+----+----+
  82.  
  83.      defined: 0.1
  84.  
  85.  implemented
  86.      l uca2b: 0.1
  87.      umgk -l: 0.1
  88.      umgk -x: 0.1
  89.  
  90. fields:
  91.   root - recordnumber of the UCODE tree.
  92.  
  93. * The header record appears only once in a UCDB and it must be
  94.   record number 1. This is the only record with such restriction.
  95.  
  96.  
  97.  
  98. * --- RECORD TYPE 2 - Module
  99.  
  100.   NR  RT P1 P2 P3  A1   A2   A3   A4   A5   A6   ATR
  101. +----+--+--+--+--+----+----+----+----+----+----+-------+
  102. |next|02|mt|--|--|body|defs|args|rslt|attr|rtf | name  |
  103. +----+--+--+--+--+----+----+----+----+----+----+-------+
  104.  
  105.      defined: 0.1-0.30
  106.  
  107.  implemented
  108.      l uca2b: 0.1
  109.      umgk -l: 0.1   only body & defs fields
  110.      umgk -x: 0.1   "                     "
  111.  
  112. fields:
  113.   mt     - module type. Only 1 type defined as of v0.30:
  114.               0 = program
  115.  
  116.   body - link to the first instruction.
  117.   defs - link to the first item in list of local definitions (i.e. vars).
  118.   args - link to first argument in the arglist.
  119.   rslt - link to the result description.
  120.   attr - attribute field, reserved for future use.
  121.   rtf  - runtime field; do not touch.
  122.   name - the module name.
  123.  
  124.  
  125.  
  126. * --- RECORD TYPE 3 - Vardef
  127.  
  128.   NR  RT P1 P2 P3  A1   A2   A3   STR
  129. +----+--+--+--+--+----+----+----+-------+
  130. |next|03|dt|--|--|dtd |dta |rtf | name  |
  131. +----+--+--+--+--+----+----+----+-------+
  132.  
  133.      defined: 0.1-0.30
  134.  
  135.  implemented
  136.        uca2b: 0.1
  137.      umgk -l: 0.1   datatypes not yet supported
  138.      umgk -x: 0.1   "                         "
  139.  
  140. fields:
  141.   dt   - the datatype
  142.   dtd  - datatype datafield
  143.   rtf  - runtime field - do not touch
  144.   name - the variable name
  145.  
  146.  
  147.  
  148. * --- RECORD TYPE 4 - Typedef
  149.  
  150.   NR  RT P1 P2 P3  A1   A2   A3   STR
  151. +----+--+--+--+--+----+----+----+-------+
  152. |next|04|dt|--|--|dtd |dta |rtf | name  |
  153. +----+--+--+--+--+----+----+----+-------+
  154.  
  155.      defined: 0.30
  156.  
  157.  implemented
  158.        uca2b: 0.30
  159.      umgk -l: not yet
  160.      umgk -x: not yet
  161.  
  162. fields:
  163.   dt   - the datatype
  164.   dtd  - datatype datafield
  165.   rtf  - runtime field - do not touch
  166.   name - the datatype name
  167.  
  168.  
  169.  
  170. * --- RECORD TYPE 5 - Numeric constant
  171.  
  172.   NR  RT P1 P2 P3  A1 
  173. +----+--+--+--+--+----+
  174. |next|05|--|--|--|val |
  175. +----+--+--+--+--+----+
  176.  
  177.      defined: 0.1
  178.  
  179.  implemented
  180.        uca2b: 0.1
  181.      umgk -l: 0.1
  182.      umgk -x: 0.1
  183.  
  184. fields:
  185.   val  - a signed 32 bit integer value.
  186.  
  187.  
  188.  
  189. * --- RECORD TYPE 6 - String constant
  190.  
  191.   NR  RT P1 P2 P3  STR 
  192. +----+--+--+--+--+-------+
  193. |next|06|--|--|--|strdat |
  194. +----+--+--+--+--+-------+
  195.  
  196.      defined: 0.1
  197.  
  198.  implemented
  199.        uca2b: 0.1
  200.      umgk -l: 0.1
  201.      umgk -x: 0.1
  202.  
  203. fields:
  204.   strdat - the string data.
  205.  
  206.  
  207.  
  208. * --- RECORD TYPE 7 - Call function
  209.  
  210.   NR  RT P1 P2 P3  A1   A2  
  211. +----+--+--+--+--+----+----+
  212. |next|07|as|--|--|sfnr|argl|
  213. +----+--+--+--+--+----+----+
  214.  
  215.      defined: 0.1
  216.  
  217.  implemented
  218.        uca2b: 0.1
  219.      umgk -l: 0.1
  220.      umgk -x: 0.1
  221.  
  222. fields:
  223.   as   - API set. Possible values as of 0.30:
  224.                     - 0 = standard API set.
  225.  
  226.  
  227.  
  228. * --- RECORD TYPE 8 - Call node
  229.  
  230.   NR  RT P1 P2 P3  A1   A2  
  231. +----+--+--+--+--+----+----+
  232. |next|08|--|--|--|node|argl|
  233. +----+--+--+--+--+----+----+
  234.  
  235.      defined: 0.30
  236.  
  237.  implemented
  238.        uca2b: 0.30
  239.      umgk -l: not yet
  240.      umgk -x: not yet
  241.  
  242. fields:
  243.   node - the node to be called.
  244.   argl - link to first item in arglist.
  245.  
  246.  
  247.  
  248. * --- RECORD TYPE 9 - If...then...else
  249.  
  250.   NR  RT P1 P2 P3  A1   A2   A3
  251. +----+--+--+--+--+----+----+----+
  252. |next|09|--|--|--|cond|texp|fexp|
  253. +----+--+--+--+--+----+----+----+
  254.  
  255.      defined: 0.1
  256.  
  257.  implemented
  258.        uca2b: 0.1
  259.      umgk -l: 0.1
  260.      umgk -x: 0.1
  261.  
  262. fields:
  263.   cond - link to condition expression.
  264.   texp - link to TRUE expression.
  265.   fexp - link to FALSEE expression.
  266.  
  267.  
  268.  
  269. * --- RECORD TYPE 10 - While...do...
  270.  
  271.   NR  RT P1 P2 P3  A1   A2  
  272. +----+--+--+--+--+----+----+
  273. |next|10|--|--|--|cond|body|
  274. +----+--+--+--+--+----+----+
  275.  
  276.      defined: 0.1
  277.  
  278.  implemented
  279.        uca2b: 0.1
  280.      umgk -l: 0.1
  281.      umgk -x: 0.1
  282.  
  283. fields:
  284.   cond - link to condition expression.
  285.   body - link to expression body.
  286.  
  287.  
  288.  
  289. * --- RECORD TYPE 11 - Do...until...
  290.  
  291.   NR  RT P1 P2 P3  A1   A2  
  292. +----+--+--+--+--+----+----+
  293. |next|11|--|--|--|cond|body|
  294. +----+--+--+--+--+----+----+
  295.  
  296.      defined: 0.1
  297.  
  298.  implemented
  299.        uca2b: 0.30
  300.      umgk -l: not yet
  301.      umgk -x: not yet
  302.  
  303. fields:
  304.   cond - link to condition expression.
  305.   body - link to expression body.
  306.  
  307.  
  308.  
  309. * --- RECORD TYPE 12 - For...
  310.  
  311. format yet to be defined
  312.  
  313.  
  314. * --- RECORD TYPE 13 - Labdef
  315.  
  316.   NR  RT P1 P2 P3  STR 
  317. +----+--+--+--+--+-------+
  318. |next|13|--|--|--| label |
  319. +----+--+--+--+--+-------+
  320.  
  321.      defined: 0.1
  322.  
  323.  implemented
  324.        uca2b: 0.1
  325.      umgk -l: 0.1
  326.      umgk -x: 0.1
  327.  
  328. fields:
  329.   label - the name of the label.
  330.  
  331.  
  332.  
  333. * --- RECORD TYPE 14 - Goto
  334.  
  335.   NR  RT P1 P2 P3  A1 
  336. +----+--+--+--+--+----+
  337. |next|14|--|--|--|node|
  338. +----+--+--+--+--+----+
  339.  
  340.      defined: 0.1
  341.  
  342.  implemented
  343.        uca2b: 0.1
  344.      umgk -l: 0.1
  345.      umgk -x: 0.1
  346.  
  347. fields:
  348.   node - node to jump to.
  349.  
  350.  
  351. * --- RECORD TYPE 15 - Assignment
  352.  
  353.   NR  RT P1 P2 P3  A1   A2  
  354. +----+--+--+--+--+----+----+
  355. |next|15|--|--|--|lexp|rexp|
  356. +----+--+--+--+--+----+----+
  357.  
  358.      defined: 0.1
  359.  
  360.  implemented
  361.        uca2b: 0.1
  362.      umgk -l: 0.1
  363.      umgk -x: 0.1
  364.  
  365. fields:
  366.   lexp - link to var record.
  367.   rexp - expression of assignment.
  368.  
  369.  
  370.  
  371. * --- RECORD TYPE 16 - Varref
  372.  
  373.   NR  RT P1 P2 P3  A1  
  374. +----+--+--+--+--+----+
  375. |next|16|--|--|--|var |
  376. +----+--+--+--+--+----+
  377.  
  378.      defined: 0.1
  379.  
  380.  implemented
  381.        uca2b: 0.1
  382.      umgk -l: 0.1
  383.      umgk -x: 0.1
  384.  
  385. fields:
  386.   var  - link to var record.
  387.  
  388.  
  389.  
  390. * --- RECORD TYPE 17 - Switch ...
  391.  
  392.   NR  RT P1 P2 P3  A1   A2   A3
  393. +----+--+--+--+--+----+----+----+
  394. |next|17|--|--|--|cond|list|dflt|
  395. +----+--+--+--+--+----+----+----+
  396.  
  397.      defined: 0.30
  398.  
  399.  implemented
  400.        uca2b: 0.30 (iffy)
  401.      umgk -l: not yet
  402.      umgk -x: not yet
  403.  
  404. fields:
  405.   cond - link to condition expression
  406.   list - link to first item in CASE list
  407.   dflt - link to default expression
  408.  
  409.  
  410.  
  411. * --- RECORD TYPE 18 - Source formatting
  412.  
  413.   NR  RT P1 P2 P3 
  414. +----+--+--+--+--+
  415. |next|18|mo|--|--|
  416. +----+--+--+--+--+
  417.  
  418.      defined: 0.30
  419.  
  420.  implemented
  421.        uca2b: 0.30
  422.      umgk -l: 0.30
  423.      umgk -x: 0.30
  424.  
  425. fields:
  426.   mo   - mode. Valid modes are:
  427.              0 = put next instruction on same line.
  428.              1 = insert a blank line.
  429.  
  430.  
  431.  
  432. * --- RECORD TYPE 19 - Source comment
  433.  
  434.   NR  RT P1 P2 P3  STR 
  435. +----+--+--+--+--+-------+
  436. |next|19|mo|--|--|commen |
  437. +----+--+--+--+--+-------+
  438.  
  439.      defined: 0.30
  440.  
  441.  implemented
  442.        uca2b: 0.30
  443.      umgk -l: 0.30
  444.      umgk -x: 0.30
  445.  
  446. fields:
  447.   mo      - mode. Valid modes are:
  448.              0 = comment after instruction.
  449.              1 = comment on a newline, at column 1.
  450.              2 = comment on a newline, indented.
  451.  
  452.   comment - the comment text.
  453.  
  454.  
  455.  
  456. * --- RECORD TYPE 20 - Unary operator
  457.  
  458.   NR  RT P1 P2 P3  A1 
  459. +----+--+--+--+--+----+
  460. |next|20|op|--|--|expr|
  461. +----+--+--+--+--+----+
  462.  
  463.      defined: 0.30
  464.  
  465.  implemented
  466.        uca2b: nothing to implement yet :)
  467.      umgk -l: "                      "
  468.      umgk -x: "                      "
  469.  
  470. fields:
  471.   op   - the unary operator. Nothing defined sofar.
  472.   expr - link to expression to apply unary operator on.
  473.  
  474.  
  475.  
  476. * --- RECORD TYPE 21 - Binnary operator
  477.  
  478.   NR  RT P1 P2 P3  A1   A2
  479. +----+--+--+--+--+----+----+
  480. |next|20|op|--|--|exp1|exp2|
  481. +----+--+--+--+--+----+----+
  482.  
  483.      defined: 0.30
  484.  
  485.  implemented
  486.        uca2b: 0.30
  487.      umgk -l: 0.30
  488.      umgk -x: 0.30
  489.  
  490. fields:
  491.   op   - the binary operator. Valid operators are:
  492.              0 = plus (addition)
  493.              1 = minus (substraction)
  494.              2 = equal
  495.              3 = not equal
  496.              4 = greather than
  497.              5 = less than
  498.              6 = greater or equal
  499.              7 = less or equal
  500.  
  501.   exp1 - link to left expression to apply binary operator on.
  502.   exp2 - link to right expression to apply binary operator on.
  503.  
  504.  
  505.